package sample.templates;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public class TypeMap {
	private Hashtable t = new Hashtable();

	public void add(Object o) {
		Class type = o.getClass();
		if (t.containsKey(type)) {
			((Vector) t.get(type)).addElement(o);
		} else {
			Vector v = new Vector();
			v.addElement(o);
			t.put(type, v);
		}
	}

	public Vector get(Class type) {
		return (Vector) t.get(type);
	}

	public Enumeration keys() {
		return t.elements();
	}

	public Fillable filler() {
		return new Fillable() {

			@Override
			public void addTrash(Trash trash) {
				add(trash);
			}

		};
	}
}
